Results 1 to 8 of 8

Thread: Help right here (lift scripting)

  1. #1
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,567

    Default Help right here (lift scripting)

    Hi m8's



    so I was really REALLY annoyed while trying to make a lift script

    I wanna make it with different way the standard script is

    $targetname move up "amount"

    & the same with move down


    that's the standard

    what i wanna make is a 3 or 4 line script using if

    like this * origin is ( 0 0 0 ) *
    PHP Code:
    main:
    spawn models/modeldir/modelname "targetname" "lift1"
    $lift1 angel 0
    $lift1 scale 5
    $lift1 setthread lift_dudes
    end

    lift_dudes
    :
    if (
    self.origin == ( 0 0 0 ))
    {
    self.origin = (self.origin + ( 0 0 1 ))
    }
    //another if part
    if (self.origin == ( 0 0 10 ))
    {
    self.origin = (self.origin + ( 0 0 [B]-1[/B] ))
    }
    waitframe
    thread lift_dudes
    end 
    I am such a scoundrelly .

    My name is Mohab
    I'm 14 years old
    NickName : RyBack
    & I wont say what i like

    so Any ideas ?

  2. #2
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Why dont you wanna use the standard way ??
    is there a reason you dont? Any difference you hope to achieve ?

    The above code you wrote wont do anything much , it will move the elevator up 1 and thats it

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  3. #3
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,567

    Default

    No
    as I know the origin will grow up till it reaches 10 ( at least that's what while do ) then it'll move down
    and that's the loop
    and I don't know why but the standard way didn't work?
    Last edited by RyBack; April 13th, 2014 at 05:29 AM.

  4. #4
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    The if statements will only be correct the first time you run it
    ie self.origin = 0 0 0
    then it will add it up by 1 ,
    but when it does the loop again , self.origin is now 0 0 1 , so it wont work.
    You need to use other expressions , like < , > , >= <= etc
    Also ( 0 0 0 ) isnt a good coord lol .

    I made a simple elevator script the other day for someone if you want it , i made it so it can go all different ways instead of just up and down lol

    call it like this
    Code:
    /// Elevator         // Start point    // Destination     // Angle
    thread elevator ( -20 20 48 )   ( -20 20 510 )   90
    And the below thread
    Code:
    elevator local.start local.destination local.angle:
    
    local.lift1 = spawn script_model
    local.lift1 model "static/nazi_crate.tik"
    local.lift1 targetname elevator
    local.lift1.origin = local.start 
    local.lift1.angle = local.angle
    local.lift1 time 3
    while (1)
    {
    
    wait 5
    local.lift1 speed 150
    local.lift1 moveTo local.destination
    local.lift1 loopsound elevator_run 
    local.lift1 waitmove
    local.lift1 stoploopsound
    wait 5
    local.lift1 moveTo local.start
    local.lift1 loopsound elevator_run 
    local.lift1 waitmove
    local.lift1 stoploopsound
    
    }
    
    end
    It uses the moveTo command as opposed to the moveUp or moveDown , thus requiring a 2nd destination coord instead of just a fixed height at which to travel to and back.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  5. #5
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,567

    Default

    Woohoo !
    I wrote something like that but error still unknown
    maybe because I wrote origins after move to
    ammmm but i wanna figure out how to make if statement work , I'll try using mathematical chars .
    & BTW , can I use move to in if statement too ?
    Last edited by RyBack; April 13th, 2014 at 10:23 AM.

  6. #6
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Post

    Quote Originally Posted by RyBack View Post
    Woohoo !
    I wrote something like that but error still unknown
    maybe because I wrote origins after move to
    If you suspect an error has occurred, you should turn developer mode and logging on by adding the following to your unnamedsoldier.cfg file:
    Code:
    seta logfile "3"
    seta developer "1"
    Then post the logs here, so we can have a look.

    Quote Originally Posted by RyBack View Post
    ammmm but i wanna figure out how to make if statement work , I'll try using mathematical chars .
    Not sure what you mean by that. Chars no less? You should figure out how to make the if statements work because they are the cornerstone of programming.

    Quote Originally Posted by RyBack View Post
    & BTW , can I use move to in if statement too ?
    You do anything you want in an if{} block. Any block of code enclosed with curly brackets represents an inner scope to the current one.
    Each while/if/switch/for scope can be nested infinitely (well, theoretically, at least). In case of the if statement, the scope will only be
    entered if the condition evaluates to true. You can then extend the condition with multiple else if statements and catch all remaining
    conditions with a final else statement like so:
    Code:
    // current scope
    if (!something) {
       // scope A
       if (!something_related) {
           // scope E
       }
    }
    else if (!something_else) {
     // scope B
    }
    else if (some_other_thing) {
      // scope C
    }
    else {
     // scope D
    }
    // At this point at most 2 conditional scopes have been executed; A, B, C, D or A and E.
    Last edited by Sor; April 14th, 2014 at 08:31 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  7. #7
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,567

    Default

    Ok ,thx Sor & purple elephant .
    &BTW I managed to check reborn patch and that was my expression
    O_O
    Can't imagine the pain of writing something like that
    & Didn't understand a sh!t in it XD

  8. #8
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,071

    Default

    Well, I think the logic is the same, but the syntax will be a little different.

    Honestly, I find c\c++ to be fairly trivial (depending on the complexity of an application), however I don't entirely understand scr's as well as a lot of members on these forums.
    And as far as what this patch consists of, well.. tbh, I consider it fairly advanced to the default user because it requires a lot of reverse engineering, assembly language and function hooking so that's why it probably makes no sense. :-P

    And btw, I'm pretty sure this patch has been in the making for about 5+ years so yeah, it was a tedious project. haha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •